/*****************************************Copyright(C)******************************************
******************************************* *********************************************
*------------------------------------------文件信息---------------------------------------------
* FileName          : user_protocol.h
* Author            : 张婷颖
* Version           : 1.0V
* Description       : 
*----------------------------------------历史版本信息-------------------------------------------
* History           :
* Description       :
*-----------------------------------------------------------------------------------------------
***********************************************************************************************/
#ifndef USER_PROTOCOL_H_
#define USER_PROTOCOL_H_
/* Includes-----------------------------------------------------------------------------------*/
#include "main.h"
/* Private define-----------------------------------------------------------------------------*/

/* Private typedef----------------------------------------------------------------------------*/
typedef struct                      //接收信息帧结构
{
	uint16_t Device_ID;             //设备ID    2字节
	uint16_t Controller_ID;         //控制器ID  2字节
	uint16_t Data_len;              //数据长度
	uint16_t *p;                     //数据
}_FRAME_INFO;


typedef struct
{
	uint8_t Device_serial;          //设备序号
	uint16_t Data_len;              //数据长度
	uint16_t Device_ID;             //设备ID    2字节
	uint16_t Controller_ID;         //控制器ID  2字节
	uint16_t *p;                     //数据
}_DEVICE_DATA_INFO;

typedef struct                      //发送帧数据域结构
{
	uint8_t Device_num ;            //设备数量
	_DEVICE_DATA_INFO Device[3]; //设备数据

}_TX_DATA_INFO;
/* Private macro------------------------------------------------------------------------------*/

/* Private variables--------------------------------------------------------------------------*/

/* Private function prototypes----------------------------------------------------------------*/

/* Private functions--------------------------------------------------------------------------*/
void Analyse_info(uint8_t *p,uint32_t len,uint8_t code);                       //解析协议，并发送协议
void tran_modbus(uint16_t *pdata,uint32_t len);                                //把modbus的数据传过来
int tran_mqtt(uint8_t *pdata,uint32_t len);                                  //把mqtt数据传过来
void protocol_num(void);                                                       //协议个数
void ask_info(void);
#endif /* USER_PROTOCOL_H_ */
